import { PublicType } from '@/interface/public';

export namespace PermissionInterface {
  // 新增权限
  export interface ReqSave {
    /**自定义请求路径 */
    customApiUrl: string;
    /* 后端接口类型 */
    apiType: 1 | 2;
    /*id */
    id: number;
    /*权限名称 */
    name: string;

    /*权限描述 */
    remark: string;

    /*操作类型 */
    actionType: PublicType['permissionType'];

    /*排序 */
    sort?: number;

    /*父级id */
    pid?: any;

    /*路由菜单访问路径 */
    path?: string;

    /*路由名称 */
    pathName?: string;

    /*组件路径 */
    componentPath?: string;

    /*路由重定向地址 */
    redirect?: string;

    /*菜单和面包屑对应的图标 */
    metaIcon?: string;

    /*后端接口地址 */
    apiUrl?: string;

    /*路由标题 (用作 document.title || 菜单的名称) */
    metaTitle?: string;

    /*当前路由为详情页时，需要高亮的菜单 */
    metaActiveMenu?: string;

    /*路由外链时填写的访问地址 */
    metaIsLink?: string;

    /*是否在菜单中隐藏 (通常列表详情页需要隐藏) */
    metaIsHide?: number;

    /*菜单是否全屏 (示例：数据大屏页面) */
    metaIsFull?: number;

    /*菜单是否固定在标签页中 (首页通常是固定项) */
    metaIsAffix?: number;

    /*当前路由是否缓存 */
    metaIsKeepAlive?: number;

    /*其他标识,通常类似功能使用同一页面是用于区分 */
    metaFlag?: string;

    /*多个以逗号分割存储 */
    metaRole?: string;

    /*-1所有系统可以访问 */
    systemId?: number;
  }

  /**
   * 权限列表
   */
  export interface ResList {
    id: number;
    name: string;
    remark?: any;
    actionType: string;
    status: number;
    sort: number;
    pid: number;
    path: string;
    pathName: string;
    componentPath?: any;
    redirect: string;
    metaIcon: string;
    apiUrl: string;
    metaTitle: string;
    metaActiveMenu: string;
    metaIsLink?: any;
    metaIsHide: number;
    metaIsFull: number;
    metaIsAffix?: any;
    metaIsKeepAlive?: any;
    metaFlag?: any;
    metaRole: string;
    systemId: number;
    childrenNumber?: any;
    createdTime: string;
    updateTime: string;
    hasChildren?: boolean;
  }

  /**平铺后的树结构 */
  export interface ResFlattenTree {
    actionType: string;
    children: ResFlattenTree[];
    component: string;
    id: string;
    meta: string;
    metaRole: string;
    name: string;
    path: string;
    pid: number;
    redirect: string;
    sort: number;
  }
}
